      1  public class Car extends Vehicle

      2  {

      3     // This instance variable is added to the subclass

      4     private String licensePlateNumber;

      5

      6     public Car()

      7     {

      8        // Use the public interface to access the instance variable of the superclass

      9        setNumberOfTires(4); // same as this.setNumberOfTires(4)

     10        licensePlateNumber = "??????";

     11     }

     12

     13     // This method is added to the subclass

     14     public void setLicensePlateNumber(String newValue)

     15     {

     16        licensePlateNumber = newValue;

     17     }

     18

     19     // This method overrides a method from the superclass

     20     public String getDescription()

     21     {

     22        return "A car with license plate " + licensePlateNumber;

     23     }

     24

     25     // This class inherits the getNumberOfTires and setNumberOfTires methods

     26  }